<!-- 类别管理遍历 -->
<style type="text/css">
	.img-item {
	    display: inline-block;
	}
	.img-item .inp{
		width: 100%;
    	padding: 5px;
	}
	.layui-form-checkbox span{
		height:auto;
	}
	.hide{
		display: none;
	}
	.show{
		display: block;
	}
</style>
<!-- 图片剪切 -->
<script type="text/javascript" src="__STATIC__/js/cropper/js/jquery-1.11.3.min.js"></script>
<script src="__STATIC__/js/cropper/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>

<link rel="stylesheet" href="__STATIC__/js/cropper/css/bootstrap.min.css" crossorigin="anonymous">
<link rel="stylesheet" href="__STATIC__/js/cropper/css/cropper.css">
<link rel="stylesheet" href="__STATIC__/js/cropper/css/main.css">
<script src="__STATIC__/js/cropper/js/cropper.js"></script>



<!-- ueditor编辑器 -->
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.js"></script>
	{notempty name="c_cates"}
		{volist name="c_cates" id="vo"}
			<div class="form-group">
				<label class="col-sm-3 control-label">{$vo.title}</label>
				<div class="col-sm-5">
					<select  class="form-control m-b" id="{$vo.field}" name="{$vo.field}">
						<option value="">请选择{$vo.title}</option>
						{volist name="$vo.two_cate" id="to"}
							<option value="{$to.id}">{$to.title}</option>
						{/volist}
					</select>
				</div>
			</div>
		{/volist}
	{/notempty}
	
	
	{volist name="arr_field" id="vo"}
		
		{if condition="$vo.type == 'title' && $vo.is_form == 1 "}
			<!-- 单行文本-->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block" style="width:500px;">
			      <input type='{if condition=" isset($vo.setup.ispassword) && $vo.setup.ispassword == 1"}password{else}text{/if}' class="layui-input field-{$vo.field}" name="{$vo.field}" {if condition="$vo.required == 1"}lay-verify="required"{/if}  autocomplete="off"  >
			    </div>
			</div>
		{/if}
		
		{if condition="$vo.type == 'image' && $vo.is_form == 1"}
			<!-- 单图片-->
			<div class="layui-form-item">
		        <label class="layui-form-label" {if condition='$vo.required == 1'}required{/if}>{$vo.name}</label>
		        <div class="layui-input-block" >
			      <input style="width:500px;" id="{$vo.field}" name="{$vo.field}" type="text" class="layui-input field-{$vo.field}" placeholder="可上传{$vo.setup.upload_allowext}格式" {if condition="$vo.required == 1"}required{/if}  >
				
			      <button class="layui-btn" id="{$vo.field}upload" type="button">{if isset($vo.setup.is_crop) /} {if $vo.setup.is_crop == 1 /} 上传图片后剪切{else/}上传图片{/if}{else/}上传图片{/if}</button><!-- （可上传{$vo.setup.upload_allowext}格式，可上传大小{:config("webconfig")['cfg_max_img_size']/1024/1024}MB，建议上传尺寸：{if isset($vo.setup.upload_size) /} {$vo.setup.upload_size} {/if}） -->

			      <!-- <button class="layui-btn" type="button" id="{$vo.field}cropper" >剪切图片</button> -->
			      （可上传{$vo.setup.upload_allowext}格式，可上传大小{:config("webconfig")['cfg_max_img_size']/1024/1024}MB，建议上传尺寸：{if isset($vo.setup.upload_size) /} {$vo.setup.upload_size} {/if}）
				  	
				  	<div class="pic" id="{$vo.field}image_show" style="margin-top:10px;">
                  		{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "}
                  		<div class="img-item">
		                    <a href="{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "} {$table_res[$vo.field]}  {/if}" target="_blank"><img src="{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "} {$table_res[$vo.field]}  {/if}" alt=""></a>
		                    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>
		                </div>
		                {/if}
            		</div>
		        </div>
		    </div>

		    <script>
		    	var uploadedImageName;
		    	var $image;
		    	var uploadedImageType;
				layui.use(['upload'], function(){
				  var $ = layui.jquery
				  ,upload = layui.upload;

				  /*//调起剪切图片
				  $("#{$vo.field}cropper").click(function(){

				  });*/

				  //普通图片上传
				  var uploadInst = upload.render({
					elem: '#{$vo.field}upload',
					url: '{:url("index/dyupload")}',
					exts: '{$vo.setup.upload_allowext}', //那么，就只会支持这三种格式的上传。注意是用|分割。
					size : {:config("webconfig")["cfg_max_img_size"]} ,//限制大小
					field: 'dypic',
					before: function(obj){
					  //预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
						$('#{$vo.field}demopic').attr('src', result); //图片链接（base64）
					  });
					},
					done: function(res){
					  //如果上传失败
					  if(res.errcode == 0){
						return layer.msg(res.message);
					  }
					  //上传成功
					  if(res.errcode == 1){
					  	var is_crop = "{if isset($vo.setup.is_crop) /}{$vo.setup.is_crop} {else/} 2 {/if}";
					  	if(is_crop == 2){
							var html = '';
			                html +='<div class="img-item">';
			                html +='    <a href="'+ res.data +'" target="_blank"><img data-url="'+res.data+'" src="'+ res.data +'" alt=""></a>';
			                html +='    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>';
			                html +='</div>';
			                
			                $('#{$vo.field}image_show').html(html)
			                $("#{$vo.field}").val(res.data);
			                
						}else{
							$("#{$vo.field}cropper_image").attr("src",res.data);
							$("#{$vo.field}cropper_image").show();
							// let size_str = "{if isset($vo.setup.upload_size) /}{$vo.setup.upload_size} {else/} {/if}";
							// let arr = size_str.split("*");
							let crop_width = "{if isset($vo.setup.upload_size_width) /}{$vo.setup.upload_size_width} {else/} 400 {/if}"
							let crop_height = "{if isset($vo.setup.upload_size_height) /}{$vo.setup.upload_size_height} {else/} 300 {/if}"
			                layer.open({
							  type: 1,
							  title:'剪切图片',
							  area:['60%','80%'],
							  content: $('#{$vo.field}cropper_view') //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
							});
							$("#{$vo.field}cropper_view").show();

							var pic = "";
					        'use strict';
					        var console = window.console || { log: function () {} };
					        var URL = window.URL || window.webkitURL;
					        $image = $('#{$vo.field}cropper_image');
					        var $dataHeight = $('#{$vo.field}dataHeight');
					        var $dataWidth = $('#{$vo.field}dataWidth');
					        var width = crop_width;
					        var height = crop_height;
					        var inputImageName = "";
					        if(width > 0 && height > 0){
					            var options = {
					                aspectRatio: width/height,
					                preview: '.img-preview',
					                crop: function (e) {
					                    $dataHeight.val(Math.round(e.detail.height));
					                    $dataWidth.val(Math.round(e.detail.width));
					                }
					            };
					        }else {
					            var options = {
					                aspectRatio: NaN,
					                preview: '.img-preview',
					                crop: function (e) {
					                    $dataHeight.val(Math.round(e.detail.height));
					                    $dataWidth.val(Math.round(e.detail.width));
					                }
					            };
					        }

					        var originalImageURL = $image.attr('src');
					        uploadedImageName = 'cropped.jpg';
					        uploadedImageType = 'image/jpeg';
					        var uploadedImageURL;

					        // Tooltip
					        $('[data-toggle="tooltip"]').tooltip();

					        // Cropper
					        $image.on({
					            crop: function (e) {

					            },
					            zoom: function (e) {
					                // console.log(e.type, e.detail.ratio);
					            }
					        }).cropper(options);

					        $image.cropper('destroy').attr('src', res.data).cropper(options);
					    }
					  }
					}
				  });
				  
				});
			</script>


<div id="{$vo.field}cropper_view" style="display: none;" >
<div class="container " >
    <div class="row" style="margin-top: 30px">
        <div class="col-md-9">
            <!-- <h3>Demo:</h3> -->
            <div class="img-container" style="width: 510px;height: 510px">
                <img id="{$vo.field}cropper_image" src="__STATIC__/js/cropper/images/picture.jpg" style="display: none;" alt="Picture">
            </div>
        </div>
        <div class="col-md-3">
            <!-- <h3>Preview:</h3> -->
            <div class="docs-preview clearfix">
                <div class="img-preview" style="max-height:140px;max-width:260px;width: 260px;height: 140px"></div>
            </div>

            <div class="docs-data">

                <div class="input-group input-group-sm">
            <span class="input-group-prepend">
              <label class="input-group-text" for="dataWidth">宽</label>
            </span>
                    <input type="text" class="form-control" readonly id="{$vo.field}dataWidth" placeholder="">
                    <span class="input-group-append">
              <span class="input-group-text">px</span>
            </span>
                </div>
                <div class="input-group input-group-sm">
            <span class="input-group-prepend">
              <label class="input-group-text" for="dataHeight">高</label>
            </span>
                    <input type="text" class="form-control" readonly id="{$vo.field}dataHeight" placeholder="">
                    <span class="input-group-append">
              <span class="input-group-text">px</span>
            </span>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-9 {$vo.field}docs-buttons">
            <!-- <h3>Toolbar:</h3> -->
            <!-- <div class="btn-group">
                <label class="btn btn-primary btn-upload" for="inputImage" title="Upload image file">
                    <input type="file" class="sr-only" id="inputImage" name="file" accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff">
                    <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
              <span class="fa fa-upload">选择文件</span>
            </span>
                </label>
            </div> -->

            <div class="btn-group">
                <button type="button"  class="btn btn-primary" data-method="zoom" data-option="0.1" title="Zoom In">
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
              <span class="fa fa-search-plus">放大</span>
            </span>
                </button>
                <button type="button"  class="btn btn-primary" data-method="zoom" data-option="-0.1" title="Zoom Out">
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
              <span class="fa fa-search-minus">缩小</span>
            </span>
                </button>
            </div>

            <div class="btn-group">
                <button type="button"  class="btn btn-primary" data-method="getCroppedCanvas" data-option="" title="Crop">
            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
              <span class="fa fa-check">确认</span>
                <!-- <div class="progress">
                    <span class="bar"></span><span class="percent">0%</span >
               </div> -->
            </span>
                </button>

            </div>
        </div>
    </div>
</div>
</div>

		<script type="text/javascript">
	        // Methods
	        $('.{$vo.field}docs-buttons').on('click', '[data-method]', function () {
	        	console.log("tangyin")
	            var $this = $(this);
	            var data = $this.data();
	            var cropper = $image.data('cropper');
	            var cropped;
	            var $target;
	            var result;

	            if ($this.prop('disabled') || $this.hasClass('disabled')) {
	                return;
	            }

	            if (cropper && data.method) {
	                data = $.extend({}, data); // Clone a new one

	                if (typeof data.target !== 'undefined') {
	                    $target = $(data.target);

	                    if (typeof data.option === 'undefined') {
	                        try {
	                            data.option = JSON.parse($target.val());
	                        } catch (e) {
	                            console.log(e.message);
	                        }
	                    }
	                }

	                cropped = cropper.cropped;

	                switch (data.method) {
	                    case 'rotate':
	                        if (cropped && options.viewMode > 0) {
	                            $image.cropper('clear');
	                        }

	                        break;

	                    case 'getCroppedCanvas':
	                        if (uploadedImageType === 'image/jpeg') {
	                            if (!data.option) {
	                                data.option = {};
	                            }

	                            data.option.fillColor = '#fff';
	                        }

	                        break;
	                }

	                result = $image.cropper(data.method, data.option, data.secondOption);

	                switch (data.method) {
	                    case 'rotate':
	                        if (cropped && options.viewMode > 0) {
	                            $image.cropper('crop');
	                        }

	                        break;

	                    case 'scaleX':
	                    case 'scaleY':
	                        $(this).data('option', -data.option);
	                        break;

	                    case 'getCroppedCanvas':
	                        if (result) {
	                            // Bootstrap's Modal
	                            /*$('#getCroppedCanvasModal').modal().find('.modal-body').html(result);
	                            layer.msg('上传中..', {
	                                icon: 16
	                                ,shade: 0.3
	                                ,time: false
	                            });*/
	                            var file_arr = uploadedImageName.split(".")
	                            var upfiles = base64toFile(result.toDataURL(uploadedImageType),file_arr[0]);
	                            console.log(upfiles)
	                            var formData = new FormData();
	                            formData.append('dypic',upfiles);
	                            $.ajax({
	                                url:"{:url('index/dyupload')}",
	                                //data: {"action":"ok","file":result.toDataURL(uploadedImageType)},
	                                //dataType:"JSON",
	                                type:"POST",
	                                data: formData,
	                                dataType: 'json',
	                                contentType: false,
	                                processData: false,
	                                beforeSend: function() {

	                                },
	                                uploadProgress: function(event, position, total, percentComplete) {

	                                },
	                                complete: function(xhr) {
	                                    $(".files").html(xhr.responseText);
	                                },
	                                success: function(data) {
	                                	layer.closeAll()

	                                	var html = '';
						                html +='<div class="img-item">';
						                html +='    <a href="'+ data.data +'" target="_blank"><img data-url="'+data.data+'" src="'+ data.data +'" alt=""></a>';
						                html +='    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>';
						                html +='</div>';
						                
						                $('#{$vo.field}image_show').html(html)
						                $("#{$vo.field}").val(data.data);
	                                },
	                                error:function(xhr){
	                                    layer.closeAll()
	                                }
	                            })
	                        }

	                        break;

	                    case 'destroy':
	                        if (uploadedImageURL) {
	                            URL.revokeObjectURL(uploadedImageURL);
	                            uploadedImageURL = '';
	                            $image.attr('src', originalImageURL);
	                        }

	                        break;
	                }

	                if ($.isPlainObject(result) && $target) {
	                    try {
	                        $target.val(JSON.stringify(result));
	                    } catch (e) {
	                        console.log(e.message);
	                    }
	                }
	            }
	        });

	        // Import image
	        var $inputImage = $('#inputImage');

	        if (URL) {
	            $inputImage.change(function () {
	                var files = this.files;
	                var file;
	                
	                if (!$image.data('cropper')) {
	                    return;
	                }

	                if (files && files.length) {
	                    file = files[0];
	                    
	                    if (/^image\/\w+$/.test(file.type)) {
	                        uploadedImageName = file.name;
	                        uploadedImageType = file.type;

	                        if (uploadedImageURL) {
	                            URL.revokeObjectURL(uploadedImageURL);
	                        }

	                        uploadedImageURL = URL.createObjectURL(file);
	                        $image.cropper('destroy').attr('src', uploadedImageURL).cropper(options);
	                        $inputImage.val('');
	                        $('.fa-search-plus').parents('button').attr('disabled',false);
	                        $('.fa-search-minus').parents('button').attr('disabled',false);
	                        $('.fa-check').parents('button').attr('disabled',false);
	                        $('#image').show();
	                    } else {
	                        window.alert('Please choose an image file.');
	                    }
	                }
	            });
	        } else {
	            $inputImage.prop('disabled', true).parent().addClass('disabled');
	        }


		    function get_pic() {
		        return pic;
		    }
		    //base64转为普通文件格式
		    function base64toFile(dataurl, filename = 'file') {
		        let arr = dataurl.split(',')
		        let mime = arr[0].match(/:(.*?);/)[1]
		        let suffix = mime.split('/')[1]
		        let bstr = atob(arr[1])
		        let n = bstr.length
		        let u8arr = new Uint8Array(n)
		        while (n--) {
		            u8arr[n] = bstr.charCodeAt(n)
		        }
		        return new File([u8arr], `${filename}.${suffix}`, {
		            type: mime
		        })
		    }
		    // dataUrl 转 blob
		    function base64toBlob (dataurl) {
		        /* eslint-disable */
		        var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1];
		        var bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
		        while(n--){
		            u8arr[n] = bstr.charCodeAt(n);
		        }
		        return new Blob([u8arr], {type:mime});
		        /* eslint-enable */
		    }

		</script>	
		{/if}
		
		{if condition="$vo.type == 'images' && $vo.is_form == 1"}
			<!-- 多图上传 -->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block" style="width:500px;">
			      	<button type="button" class="layui-btn" id="{$vo.field}upload">{if isset($vo.setup.is_crop) /} {if $vo.setup.is_crop == 1 /}多图片上传后剪切{else/}多图片上传{/if} {else/}上传图片   {/if}</button> （可上传{$vo.setup.upload_allowext}格式，可上传大小{:config("webconfig")['cfg_max_img_size']/1024/1024}MB，建议上传尺寸：{if isset($vo.setup.upload_size) /} {$vo.setup.upload_size} {/if}）
			      	<br>
					<div class="layui-upload-list " id="{$vo.field}show" >
						{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "}
							{volist name="$table_res[$vo.field]" id="vo2"}
							
	                      	<div class="img-item">
			                    <a href="{$vo2}" target="_blank"><img  src="{$vo2}" alt=""></a>
			                    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>
			                    <input class="inp" type="text" name="{$vo.field}[{$i-1}]" value="{$vo2}">
			                </div>

	                      	{/volist}
                      	{/if}

					</div>
			    </div>
			</div>
			<script>
				var uploadedImageName;
		    	var $image;
		    	var uploadedImageType;
		    	{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "}
				  var i = {:count($table_res[$vo.field])};
			  	{else /}
				  var i = 0;
			  	{/if}

			  	var cropper_pot;
			  	var URL;
			  	var is_crop = "{if isset($vo.setup.is_crop) /}{$vo.setup.is_crop} {else/} 2 {/if}";
				layui.use('upload', function(){
				  var $ = layui.jquery
				  ,upload = layui.upload;
				  var urls = '';

				  //多图片上传
				  upload.render({
					elem: '#{$vo.field}upload'
					,url: '{:url("index/dyupload")}'
					,multiple: is_crop==2?true:false
					,exts: '{$vo.setup.upload_allowext}'
					,size : {:config("webconfig")["cfg_max_img_size"]} //限制大小
					,field: 'dypic'
					,before: function(obj){
					  //预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
						//$('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img" style="width:100px;height:92px;margin-right:5px;">')
					  });
					}
					,done: function(res){
						if(res.errcode == 0){
							return layer.msg(res.message);
					  	}
					  	if(res.errcode == 1){

					  		
					  		//不需要剪切
					  		if(is_crop == 2){
								var html = '';
				                html +='<div class="img-item">';
				                html +='    <a href="'+ res.data +'" target="_blank"><img data-url="'+res.data+'" src="'+ res.data +'" alt=""></a>';
				                html +='    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>';
				                html +='    <input class="inp" type="text" name="{$vo.field}['+i+']" value="'+res.data+'">';
				                html +='</div>';
				                $("#{$vo.field}show").append(html);
								i++;
							}else{
								//需要剪切
								$("#{$vo.field}cropper_image").attr("src",res.data);
								$("#{$vo.field}cropper_image").show();
								// let size_str = "{if isset($vo.setup.upload_size) /}{$vo.setup.upload_size} {else/} {/if}";
								// let arr = size_str.split("*");
								let crop_width = "{if isset($vo.setup.upload_size_width) /}{$vo.setup.upload_size_width} {else/} 400 {/if}"
								let crop_height = "{if isset($vo.setup.upload_size_height) /}{$vo.setup.upload_size_height} {else/} 300 {/if}"
				                layer.open({
								  type: 1,
								  title:'剪切图片',
								  area:['60%','80%'],
								  content: $('#{$vo.field}cropper_view') //这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
								});
								$("#{$vo.field}cropper_view").show();

								var pic = "";
						        'use strict';
						        var console = window.console || { log: function () {} };
						        URL = window.URL || window.webkitURL;
						        $image = $('#{$vo.field}cropper_image');
						        //$image.destroy();
						        var $dataHeight = $('#{$vo.field}dataHeight');
						        var $dataWidth = $('#{$vo.field}dataWidth');
						        var width = crop_width;
						        var height = crop_height;
						        var inputImageName = "";
						        if(width > 0 && height > 0){
						            var options = {
						                aspectRatio: width/height,
						                preview: '.img-preview',
						                crop: function (e) {
						                    $dataHeight.val(Math.round(e.detail.height));
						                    $dataWidth.val(Math.round(e.detail.width));
						                }
						            };
						        }else {
						            var options = {
						                aspectRatio: NaN,
						                preview: '.img-preview',
						                crop: function (e) {
						                    $dataHeight.val(Math.round(e.detail.height));
						                    $dataWidth.val(Math.round(e.detail.width));
						                }
						            };
						        }

						        var originalImageURL = $image.attr('src');
						        uploadedImageName = 'cropped.jpg';
						        uploadedImageType = 'image/jpeg';
						        var uploadedImageURL;

						        // Tooltip
						        $('[data-toggle="tooltip"]').tooltip();

						        // Cropper
						        $image.on({
						            crop: function (e) {

						            },
						            zoom: function (e) {
						                // console.log(e.type, e.detail.ratio);
						            }
						        }).cropper(options);

						        $image.cropper('destroy').attr('src', res.data).cropper(options);
							}
						}
					}
				  });
				});
			</script>



			<div id="{$vo.field}cropper_view" style="display: none;" >
			<div class="container " >
			    <div class="row" style="margin-top: 30px">
			        <div class="col-md-9">
			            <!-- <h3>Demo:</h3> -->
			            <div class="img-container" style="width: 510px;height: 510px">
			                <img id="{$vo.field}cropper_image" src="__STATIC__/js/cropper/images/picture.jpg" style="display: none;" alt="Picture">
			            </div>
			        </div>
			        <div class="col-md-3">
			            <!-- <h3>Preview:</h3> -->
			            <div class="docs-preview clearfix">
			                <div class="img-preview" style="max-height:140px;max-width:260px;width: 260px;height: 140px"></div>
			            </div>

			            <div class="docs-data">

			                <div class="input-group input-group-sm">
			            <span class="input-group-prepend">
			              <label class="input-group-text" for="dataWidth">宽</label>
			            </span>
			                    <input type="text" class="form-control" readonly id="{$vo.field}dataWidth" placeholder="">
			                    <span class="input-group-append">
			              <span class="input-group-text">px</span>
			            </span>
			                </div>
			                <div class="input-group input-group-sm">
			            <span class="input-group-prepend">
			              <label class="input-group-text" for="dataHeight">高</label>
			            </span>
			                    <input type="text" class="form-control" readonly id="{$vo.field}dataHeight" placeholder="">
			                    <span class="input-group-append">
			              <span class="input-group-text">px</span>
			            </span>
			                </div>
			            </div>
			        </div>
			    </div>
			    <div class="row">
			        <div class="col-md-9 {$vo.field}docs-buttons">
			            <!-- <h3>Toolbar:</h3> -->
			            <!-- <div class="btn-group">
			                <label class="btn btn-primary btn-upload" for="inputImage" title="Upload image file">
			                    <input type="file" class="sr-only" id="inputImage" name="file" accept=".jpg,.jpeg,.png,.gif,.bmp,.tiff">
			                    <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
			              <span class="fa fa-upload">选择文件</span>
			            </span>
			                </label>
			            </div> -->

			            <div class="btn-group">
			                <button type="button"  class="btn btn-primary" data-method="zoom" data-option="0.1" title="Zoom In">
			            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
			              <span class="fa fa-search-plus">放大</span>
			            </span>
			                </button>
			                <button type="button"  class="btn btn-primary" data-method="zoom" data-option="-0.1" title="Zoom Out">
			            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
			              <span class="fa fa-search-minus">缩小</span>
			            </span>
			                </button>
			            </div>

			            <div class="btn-group">
			                <button type="button"  class="btn btn-primary" data-method="getCroppedCanvas" data-option="" title="Crop">
			            <span class="docs-tooltip" data-toggle="tooltip" data-animation="false" title="">
			              <span class="fa fa-check">确认</span>
			                <!-- <div class="progress">
			                    <span class="bar"></span><span class="percent">0%</span >
			               </div> -->
			            </span>
			                </button>

			            </div>
			        </div>
			    </div>
			</div>
			</div>

					<script type="text/javascript">
				        // Methods
				        $('.{$vo.field}docs-buttons').on('click', '[data-method]', function () {
				        	console.log("tangyin")
				            var $this = $(this);
				            var data = $this.data();
				            var cropper = $image.data('cropper');
				            var cropped;
				            var $target;
				            var result;

				            if ($this.prop('disabled') || $this.hasClass('disabled')) {
				                return;
				            }

				            if (cropper && data.method) {
				                data = $.extend({}, data); // Clone a new one

				                if (typeof data.target !== 'undefined') {
				                    $target = $(data.target);

				                    if (typeof data.option === 'undefined') {
				                        try {
				                            data.option = JSON.parse($target.val());
				                        } catch (e) {
				                            console.log(e.message);
				                        }
				                    }
				                }

				                cropped = cropper.cropped;

				                switch (data.method) {
				                    case 'rotate':
				                        if (cropped && options.viewMode > 0) {
				                            $image.cropper('clear');
				                        }

				                        break;

				                    case 'getCroppedCanvas':
				                        if (uploadedImageType === 'image/jpeg') {
				                            if (!data.option) {
				                                data.option = {};
				                            }

				                            data.option.fillColor = '#fff';
				                        }

				                        break;
				                }

				                result = $image.cropper(data.method, data.option, data.secondOption);

				                switch (data.method) {
				                    case 'rotate':
				                        if (cropped && options.viewMode > 0) {
				                            $image.cropper('crop');
				                        }

				                        break;

				                    case 'scaleX':
				                    case 'scaleY':
				                        $(this).data('option', -data.option);
				                        break;

				                    case 'getCroppedCanvas':
				                        if (result) {
				                            // Bootstrap's Modal
				                            /*$('#getCroppedCanvasModal').modal().find('.modal-body').html(result);
				                            layer.msg('上传中..', {
				                                icon: 16
				                                ,shade: 0.3
				                                ,time: false
				                            });*/
				                            //cropper_pot.destroy();
				                            var file_arr = uploadedImageName.split(".")
				                            var upfiles = base64toFile(result.toDataURL(uploadedImageType),file_arr[0]);
				                            console.log(upfiles)
				                            var formData = new FormData();
				                            formData.append('dypic',upfiles);
				                            $.ajax({
				                                url:"{:url('index/dyupload')}",
				                                //data: {"action":"ok","file":result.toDataURL(uploadedImageType)},
				                                //dataType:"JSON",
				                                type:"POST",
				                                data: formData,
				                                dataType: 'json',
				                                contentType: false,
				                                processData: false,
				                                beforeSend: function() {

				                                },
				                                uploadProgress: function(event, position, total, percentComplete) {

				                                },
				                                complete: function(xhr) {
				                                    $(".files").html(xhr.responseText);
				                                },
				                                success: function(data) {
				                                	layer.closeAll()

				                                	var html = '';
									                html +='<div class="img-item">';
									                html +='    <a href="'+ data.data +'" target="_blank"><img data-url="'+data.data+'" src="'+ data.data +'" alt=""></a>';
									                html +='    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>';
									                html +='    <input class="inp" type="text" name="{$vo.field}['+i+']" value="'+data.data+'">';
									                html +='</div>';
									                $("#{$vo.field}show").append(html);
													i++;
				                                	
				                                },
				                                error:function(xhr){
				                                    layer.closeAll()
				                                }
				                            })
				                        }

				                        break;

				                    case 'destroy':
				                        if (uploadedImageURL) {
				                            URL.revokeObjectURL(uploadedImageURL);
				                            uploadedImageURL = '';
				                            $image.attr('src', originalImageURL);
				                        }

				                        break;
				                }

				                if ($.isPlainObject(result) && $target) {
				                    try {
				                        $target.val(JSON.stringify(result));
				                    } catch (e) {
				                        console.log(e.message);
				                    }
				                }
				            }
				        });

				        // Import image
				        var $inputImage = $('#{$vo.field}cropper_image');

				        //if (URL) {
				            $inputImage.change(function () {
				                var files = this.files;
				                var file; 
				        
				                if (!$image.data('cropper')) {
				                    return;
				                }
				                if (files && files.length) {
				                    file = files[0];
				                    
				                    if (/^image\/\w+$/.test(file.type)) {
				                        uploadedImageName = file.name;
				                        uploadedImageType = file.type;

				                        if (uploadedImageURL) {
				                            URL.revokeObjectURL(uploadedImageURL);
				                        }

				                        uploadedImageURL = URL.createObjectURL(file);
				                        $image.cropper('destroy').attr('src', uploadedImageURL).cropper(options);
				                        $inputImage.val('');
				                        $('.fa-search-plus').parents('button').attr('disabled',false);
				                        $('.fa-search-minus').parents('button').attr('disabled',false);
				                        $('.fa-check').parents('button').attr('disabled',false);
				                        $('#image').show();
				                    } else {
				                        window.alert('Please choose an image file.');
				                    }
				                }
				            });
				        // } else {
				        //     $inputImage.prop('disabled', true).parent().addClass('disabled');
				        // }


					    function get_pic() {
					        return pic;
					    }
					    //base64转为普通文件格式
					    function base64toFile(dataurl, filename = 'file') {
					        let arr = dataurl.split(',')
					        let mime = arr[0].match(/:(.*?);/)[1]
					        let suffix = mime.split('/')[1]
					        let bstr = atob(arr[1])
					        let n = bstr.length
					        let u8arr = new Uint8Array(n)
					        while (n--) {
					            u8arr[n] = bstr.charCodeAt(n)
					        }
					        return new File([u8arr], `${filename}.${suffix}`, {
					            type: mime
					        })
					    }
					    // dataUrl 转 blob
					    function base64toBlob (dataurl) {
					        /* eslint-disable */
					        var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1];
					        var bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n);
					        while(n--){
					            u8arr[n] = bstr.charCodeAt(n);
					        }
					        return new Blob([u8arr], {type:mime});
					        /* eslint-enable */
					    }

					</script>

			

		{/if}
		
		{if condition="$vo.type == 'file' && $vo.is_form == 1"}
			<!-- 文件上传 file-->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block" style="width:500px;">
			      	<input id="{$vo.field}" name="{$vo.field}" type="text" class="layui-input field-{$vo.field}" placeholder="" {if condition="$vo.required == 1"}required{/if}  >
					<button class="layui-btn" id="{$vo.field}upload" type="button">上传文件</button>（可上传{$vo.setup.upload_allowext}格式，可上传大小{:config("webconfig")['cfg_max_file_size']/1024/1024}MB）
				  	
				  	<div class="pic" id="{$vo.field}image_show" style="margin-top:10px;">
                  		{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "}
                  		<div class="img-item">
		                    <a href="{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "} {$table_res[$vo.field]}  {/if}" target="_blank"><img src="__STATIC__/admin/img/file.png" alt=""></a>
		                    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>
		                </div>
		                {/if}
            		</div>
			    </div>
			</div>
			
			<script>
				layui.use(['upload'], function(){
				  var $ = layui.jquery
				  ,upload = layui.upload;
				  //普通图片上传
				  var uploadInst = upload.render({
					elem: '#{$vo.field}upload',
					url: '{:url("index/dyuploadfile")}',
					exts: '{$vo.setup.upload_allowext}', //那么，就只会支持这三种格式的上传。注意是用|分割。
					size : {:config("webconfig")["cfg_max_file_size"]} ,//限制大小
					before: function(obj){
					  //预读本地文件示例，不支持ie8
					  
					},
					done: function(res){
						// console.log(res)
						// return false
					  //如果上传失败
					  if(res.errcode == 0){
						return layer.msg(res.message);
					  }
					  //上传成功
					  if(res.errcode == 1){
						//$("#{$vo.field}").val(res.url);
						var html = '';
		                html +='<div class="img-item">';
		                html +='    <a href="'+ res.data +'" target="_blank"><img src="__STATIC__/admin/img/file.png" alt=""></a>';
		                html +='    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>';
		                html +='</div>';
		                
		                $('#{$vo.field}image_show').html(html)
		                $("#{$vo.field}").val(res.data);
					  }
					}
				  });
				  
				});
			</script>
		{/if}


		{if condition="$vo.type == 'video' && $vo.is_form == 1"}
			<!-- 视频上传 video-->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block" style="width:500px;">
			      	<input id="{$vo.field}" name="{$vo.field}" type="text" class="layui-input field-{$vo.field}" placeholder="" {if condition="$vo.required == 1"}required{/if}  >
					<button class="layui-btn" id="{$vo.field}upload" type="button">上传文件</button>（可上传{$vo.setup.upload_allowext}格式，可上传大小{:config("webconfig")['cfg_max_video_size']/1024/1024}MB）
				  	
				  	<div class="pic" id="{$vo.field}image_show" style="margin-top:10px;">
                  		{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "}
                  		<div class="img-item">
		                    <a href="{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "} {$table_res[$vo.field]}  {/if}" target="_blank"><img src="__STATIC__/admin/img/file.png" alt=""></a>
		                    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>
		                </div>
		                {/if}
            		</div>

			    </div>
			</div>
			
			<script>
				layui.use(['upload'], function(){
				  var $ = layui.jquery
				  ,upload = layui.upload;
				  //普通图片上传
				  var uploadInst = upload.render({
					elem: '#{$vo.field}upload',
					url: '{:url("index/dyuploadVideo")}',
					exts: '{$vo.setup.upload_allowext}', //那么，就只会支持这三种格式的上传。注意是用|分割。
					size : {:config("webconfig")["cfg_max_video_size"]} ,//限制大小
					field: 'dyvideo',
					before: function(obj){
					  //预读本地文件示例，不支持ie8
					  
					},
					done: function(res){
						// console.log(res)
						// return false
					  //如果上传失败
					  if(res.errcode == 0){
						return layer.msg(res.message);
					  }
					  //上传成功
					  if(res.errcode == 1){
						//$("#{$vo.field}").val(res.url);
						var html = '';
		                html +='<div class="img-item">';
		                html +='    <a href="'+ res.data +'" target="_blank"><img src="__STATIC__/admin/img/file.png" alt=""></a>';
		                html +='    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>';
		                html +='</div>';
		                
		                $('#{$vo.field}image_show').html(html)
		                $("#{$vo.field}").val(res.data);
					  }
					}
				  });
				  
				});
			</script>
		{/if}


		{if condition="$vo.type == 'textarea' && $vo.is_form == 1"}
			<!-- 多行文本-->
			<div class="layui-form-item layui-form-text">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block">
			      <textarea {if condition="$vo.required == 1"}lay-verify="required"{/if} class="layui-textarea field-{$vo.field}" name="{$vo.field}" style="width:500px;">{$vo.setup.default}</textarea>
			    </div>
			</div>
		{/if}
		
		{if condition="$vo.type == 'editor' && $vo.is_form == 1"}
			<!-- 编辑器 -->
			{if condition="isset($vo.setup.edittype) && $vo.setup.edittype == 'layedit'"}
			<!-- layui编辑器 -->
			<div class="layui-form-item layui-form-text">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block">
			      <textarea class="layui-textarea" id="{$vo.field}" name="{$vo.field}" >{if condition="isset($table_res[$vo.field])"} {$table_res[$vo.field] }  {/if}</textarea>
			    </div>
			</div>
			<script>
			layui.use(['form','layedit'], function(){
			  var form = layui.form,layedit = layui.layedit
			  ,$ = layui.jquery;
			  
			  layedit.set({  
					uploadImage: {  
						url: '{:url("index/dyuploadlayedit")}' //接口url  
					  , type: 'post' //默认post  
					}  
				});
			  
			  var index = layedit.build("{$vo.field}");
            //console.log(tt)

			});
			</script>
			{/if}
			
			{if condition=" isset($vo.setup.edittype) && $vo.setup.edittype == 'UEditor'"}
			<!-- 百度编辑器 -->
			<div class="layui-form-item layui-form-text">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}" style="width:800px;">{$vo.name}</label>
			    <div class="layui-input-block">
			      	<script id="{$vo.field}" name="{$vo.field}"  type="text/plain" style="height:300px;width:800px;">{if condition="isset($table_res[$vo.field])"} {$table_res[$vo.field] | raw}  {/if}</script>
					<script type="text/javascript">
						var ue{$vo.field} = UE.getEditor("{$vo.field}");
						
					</script>
			    </div>
			</div>
			{/if}
			
		{/if}

		{if condition="$vo.type == 'article' && $vo.is_form == 1"}
		<!-- 采集 -->
		<!-- 百度编辑器 -->
		<div class="layui-form-item layui-form-text">
		    <label class="layui-form-label" style="width:800px;">{$vo.name}</label>
		    <div class="layui-input-block {if condition='$vo.required == 1'}required{/if}">
		      	<script id="{$vo.field}" name="{$vo.field}"  type="text/plain" style="height:300px;width:800px;">{if condition="isset($table_res[$vo.field])"} {$table_res[$vo.field] | raw}  {/if}</script>
				<script type="text/javascript">
					var ue{$vo.field} = UE.getEditor("{$vo.field}");
					
				</script>
		    </div>
		</div>
		<div class="layui-form-item">
	        <label class="layui-form-label ">文章采集</label>
	        <div class="layui-input-inline" style="width:300px;margin-left:30px;">
	            <input type="text" id="WeChatUrl{$vo.field}"  autocomplete="off" class="layui-input" placeholder="请输入微信公众号文章网址">
	        </div>
	        <div class="layui-input-inline">
	            <button type="button" id="wechatcollect{$vo.field}" class="layui-btn">采集</button>
	        </div>
	    </div>

	    <script type="text/javascript">
	    	$("#wechatcollect{$vo.field}").click(function(){
	            let WeChatUrl = $("#WeChatUrl{$vo.field}").val();
	            if(WeChatUrl == ''){
	                layer.msg('请输入要采集的微信公众号文章网址',{icon:5});
	                return;
	            }
	            if(WeChatUrl.length < 30){
	                layer.msg('请正确输入要采集的微信公众号文章网址',{icon:5});
	                return;
	            }
	            layer.confirm('你确定要执行采集吗?<br>网速、图片大小、数量<br>都跟采集的速度有直接关系', {
	                title:"温馨提示",
	                closeBtn:0,
	                //shift:6,
	                // anim:6,
	                icon:0,
	                btn: ['确定','取消'] //按钮
	            }, function(){
	                $(".btn").attr("disabled", true);
	                var loading = layer.msg('数据采集中，请稍后...', {
	                    icon: 16,offset: '300px',shade: 0.2,time:10000000
	                });
	                //var WeChatUrl = $("#WeChatUrl_"+field).val();
	                //console.log(url);
	                $.ajax({
	                    type: 'POST',
	                    url: "{:url('WeChat/weChatUrl')}",
	                    data:{WeChatUrl:WeChatUrl},
	                    dataType: 'json',
	                    success: function(data){
	                        layer.close(loading);
	                        console.log(data)
	                        // return false
	                        if (data.errcode == 1) {
	                            layer.msg(data.message, {icon: 1, time: 2000},function(){
	                                //$("#title").val(data.data.title);
	                                $("#{$vo.field}").val(data.data.content);
	                                //var ue = UE.getEditor("container");
	                                ue{$vo.field}.ready(function () {
	                                    ue{$vo.field}.setContent(data.data.content); //赋值给UEditor 
	                                });

	                                //封面图
	                                // if(data.data.cover){
	                                //     console.log("tangy")
	                                //     var html = '';
	                                //     html +='<div class="img-item">';
	                                //     html +='    <a href="'+ data.data.cover +'" target="_blank"><img data-url="'+data.data.cover+'" src="'+ data.data.cover +'" alt=""></a>';
	                                //     html +='    <i  class="layui-icon layui-icon-close-fill" onclick="imgdelete(this)"></i>';
	                                //     html +='</div>';
	                                //     $('#image_show').html(html)
	                                // }

	                            });
	                        } else {
	                            layer.msg(data.message, {icon: 2,time: 2000});
	                        }
	                        $(".btn").attr("disabled", false);
	                    
	                    },
	                    error: function(){
	                        layer.alert("服务器繁忙, 请联系管理员!");
	                    }
	                });
	            });

	        });
	    </script>


		{/if}

		{if condition="$vo.type == 'radio' && $vo.is_form == 1"}
		<!-- 单选框 -->
		<div class="layui-form-item" >
		    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
		    <div class="layui-input-block" >
		    	{volist name="$vo.setup.options" id="ra"}
		    		<input type="radio" name="{$vo.field}" value="{$ra.1}" title="{$ra.0}" class="field-{$vo.field}" {if condition="$key == 0"}checked{/if}>
		    	{/volist}
		    </div>
		    <div class="layui-form-mid layui-word-aux" style="margin-left: 33px;" >对应值：{$vo.setup.options_name}</div>
		</div>
		{/if}
		
		{if condition="$vo.type == 'checkbox' && $vo.is_form == 1"}
			<!-- 复选框 -->
			<div class="layui-form-item" pane="">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block">
			      	{volist name="$vo.setup.options" id="ra"}
					<input type="checkbox" name="{$vo.field}[{$key}]" lay-skin="primary" value="{$ra.1}" title="{$ra.0}" class="field-{$vo.field}">
					{/volist}
			    </div>
			    <div class="layui-form-mid layui-word-aux">对应值：{$vo.setup.options_name}</div>
			</div>
		{/if}
		
		{if condition="$vo.type == 'number' && $vo.is_form == 1"}
			<!-- 数字 -->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block" style="width:500px;">
			      	<input class="layui-input field-{$vo.field}" id="{$vo.field}" name="{$vo.field}" placeholder="{$vo.setup.dian}"  {if condition="$vo.field == 'hits'"}value=""{/if} {if condition="$vo.field == 'orderid'"}value="{:GetOrderID($module)}"{/if} type="number" {if condition="$vo.required == 1"}lay-verify="required"{/if}   >
			    </div>
			  </div>
		{/if}

		{if condition="$vo.type == 'date' && $vo.is_form == 1  "}
			<!-- 日期 -->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block" style="width:500px;">
			      	<input  type='text' class="layui-input field-{$vo.field}" id="{$vo.field}" name="{$vo.field}" placeholder="" {if condition="$vo.required == 1"}lay-verify="required"{/if} autocomplete="off" value="{if isset($table_res[$vo.field]) && $table_res[$vo.field] != '' /}{$table_res[$vo.field]}{/if}" >
			    </div>
			</div>
			<script>
				layui.use('laydate', function(){
				  var laydate = layui.laydate;
				  //常规用法
				  laydate.render({
					elem: '#{$vo.field}'
				  });
				  
				});
			</script>
		{/if}
		
		{if condition="$vo.type == 'datetime' && $vo.is_form == 1 "}
			<!-- 日期 -->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-block" style="width:500px;">
			      	<input  type='text' class="layui-input field-{$vo.field}" id="{$vo.field}" name="{$vo.field}" placeholder="" {if condition="$vo.required == 1"}lay-verify="required"{/if} autocomplete="off" value="{if isset($table_res[$vo.field]) && $table_res[$vo.field] != '' /}{$table_res[$vo.field]}{/if}" >
			    </div>
			</div>
			<script>
				layui.use('laydate', function(){
				  var laydate = layui.laydate;
				  //常规用法
				  laydate.render({
					elem: '#{$vo.field}',
					type: 'datetime'
				  });
				  
				});
			</script>
		{/if}
		
		{if condition="$vo.type == 'select' && $vo.is_form == 1"}
			<!-- 下拉框 -->
			{if condition="$vo.setup.multiple ==1"}
			<!-- 单选下拉 -->
			<div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-inline">
			      <select id="{$vo.field}" name="{$vo.field}" class="field-{$vo.field}">
						<option value=""></option>
						{volist name="$vo.setup.options" id="ra"}
						<option value="{$ra.1}" >{$ra.0}</option>
						{/volist}
			      </select>
			    </div>
			    <div class="layui-form-mid layui-word-aux">对应值：{$vo.setup.options_name}</div>
			</div>
			{/if}
			
			{if condition="$vo.setup.multiple ==0 "}
			<!-- layui下拉多选-->
			<script src="__STATIC__/js/xm-select.js" ></script>

            <div class="layui-form-item">
			    <label class="layui-form-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
			    <div class="layui-input-inline" style="width:500px;">
			      <div id="{$vo.field}" class="xm-select-demo"></div>
			      <input type="hidden" id="hid_{$vo.field}" name="{$vo.field}" value='{if condition="isset($table_res[$vo.field]) && $table_res[$vo.field] "} {$table_res[$vo.field]} {/if}' >
			    </div>
			    <div class="layui-form-mid layui-word-aux">对应值：{$vo.setup.options_name}</div>
			</div>
			<script>
			var demo3 = xmSelect.render({
				el: '#{$vo.field}', 
				toolbar: {
					show: true
				},
				on: function(data){
					//可以return一个数组, 代表想选中的数据
					//arr:  当前多选已选中的数据
					var arr = data.arr;
					console.log(arr)
					let str = '';
					for(let i=0;i<arr.length;i++){
						str += arr[i].value + ",";
					}
					str=str.substring(0,str.length-1);
					$("#hid_{$vo.field}").val(str);

					//change, 此次选择变化的数据,数组
					var change = data.change;
					//isAdd, 此次操作是新增还是删除
					/*var isAdd = data.isAdd;
					if(isAdd){
						var allItem = change.find(function(item){
							return item.value === 0;
						})
						if(allItem){
							return [allItem];
						}
						allItem = arr.find(function(item){
							//console.log(change)
							return item.value === 0;
						})
						if(allItem){
							return change;
						}
						//console.log(allItem)
					}*/
					
				},
				data: [
					// {name: '全选', value: 0},
					{volist name="$vo.setup.options" id="ra"}
					{name: '{$ra.0}', value: {$ra.1},selected:{$ra.2} },
					{/volist}
				]
			})
			</script>
			
			{/if}
		{/if}
		
		<!-- 联动菜单 -->
		{if condition="$vo.type == 'linkage' && $vo.is_form == 1"}
			<div class="form-group">
				<label class="col-sm-3 control-label {if condition='$vo.required == 1'}required{/if}">{$vo.name}</label>
				<div id="{$vo.field}">
					<div class="col-sm-2" >
						<select  class="form-control m-b prov " style="width:200px;" name="{$vo.field}_prov"></select>	
					</div>
					<div class="col-sm-2" >
						<select  class="form-control m-b city " style="width:200px;" name="{$vo.field}_city"></select>
					</div>
					<div class="col-sm-2" >
						<select  class="form-control m-b dist " style="width:200px;" name="{$vo.field}_dist"></select>
					</div>
				</div>
			</div>
			
			<script>
				(function($) {
					$.fn.citySelect = function(settings) {
						if (this.length < 1) {
							return;
						}
						// 默认值
						settings = $.extend({
							url: "__ADMINJS__/city.min.js",
							prov: null,
							city: null,
							dist: null,
							nodata: null,
							required: true
						}, settings);
	
						var box_obj = this;
						var prov_obj = box_obj.find(".prov");
						var city_obj = box_obj.find(".city");
						var dist_obj = box_obj.find(".dist");
						var prov_val = settings.prov;
						var city_val = settings.city;
						var dist_val = settings.dist;
						var select_prehtml = (settings.required) ? "" : "<option value=''>请选择</option>";
						var city_json;
	
						// 赋值市级函数
						var cityStart = function() {
							var prov_id = prov_obj.get(0).selectedIndex;
							if (!settings.required) {
								prov_id--;
							}
							;
							city_obj.empty().attr("disabled", true);
							dist_obj.empty().attr("disabled", true);
	
							if (prov_id < 0 || typeof (city_json.citylist[prov_id].c) == "undefined") {
								if (settings.nodata == "none") {
									city_obj.css("display", "none");
									dist_obj.css("display", "none");
								} else if (settings.nodata == "hidden") {
									city_obj.css("visibility", "hidden");
									dist_obj.css("visibility", "hidden");
								}
								;
								return;
							}
							;
	
							// 遍历赋值市级下拉列表
							temp_html = select_prehtml;
							$.each(city_json.citylist[prov_id].c, function(i, city) {
								temp_html += "<option value='" + city.n + "'>" + city.n + "</option>";
							});
							city_obj.html(temp_html).attr("disabled", false).css({"display": "", "visibility": ""});
							distStart();
						};
	
						// 赋值地区（县）函数
						var distStart = function() {
							var prov_id = prov_obj.get(0).selectedIndex;
							var city_id = city_obj.get(0).selectedIndex;
							if (!settings.required) {
								prov_id--;
								city_id--;
							}
							;
							dist_obj.empty().attr("disabled", true);
	
							if (prov_id < 0 || city_id < 0 || typeof (city_json.citylist[prov_id].c[city_id].a) == "undefined") {
								if (settings.nodata == "none") {
									dist_obj.css("display", "none");
									$('.quxian').css('display','none');
									
								} else if (settings.nodata == "hidden") {
									dist_obj.css("visibility", "hidden");
									
								}
								;
								return;
							}else{
							
							$('.quxian').css('display','block');
							}
							;
	
							// 遍历赋值市级下拉列表
							temp_html = select_prehtml;
							$.each(city_json.citylist[prov_id].c[city_id].a, function(i, dist) {
								temp_html += "<option value='" + dist.s + "'>" + dist.s + "</option>";
							});
							dist_obj.html(temp_html).attr("disabled", false).css({"display": "", "visibility": ""});
						};
	
						var init = function() {
							// 遍历赋值省份下拉列表
							temp_html = select_prehtml;
							$.each(city_json.citylist, function(i, prov) {
								temp_html += "<option value='" + prov.p + "'>" + prov.p + "</option>";
							});
							prov_obj.html(temp_html);
	
							// 若有传入省份与市级的值，则选中。（setTimeout为兼容IE6而设置）
							setTimeout(function() {
								if (settings.prov != null) {
									prov_obj.val(settings.prov);
									cityStart();
									setTimeout(function() {
										if (settings.city != null) {
											city_obj.val(settings.city);
											distStart();
											setTimeout(function() {
												if (settings.dist != null) {
													dist_obj.val(settings.dist);
												}
												;
											}, 1);
										}
										;
									}, 1);
								}
								;
							}, 1);
	
							// 选择省份时发生事件
							prov_obj.bind("change", function() {
								cityStart();
							});
	
							// 选择市级时发生事件
							city_obj.bind("change", function() {
								distStart();
							});
						};
	
						// 设置省市json数据
						if (typeof (settings.url) == "string") {
							$.getJSON(settings.url, function(json) {
								city_json = json;
								init();
							});
						} else {
							city_json = settings.url;
							init();
						}
						;
					};
				})(jQuery);
						
			</script>
			
	        <script type="text/javascript">
				
	            $(function() {
	                $("#{$vo.field}").citySelect({
	                    prov: "浙江",
	                    city: "杭州",
	                    dist: "西湖区",
	                    nodata: "none"
	                });
	            });
	        </script>
		{/if}
	{/volist}